import time

from pydantic import BaseModel, Field


class PO(BaseModel):
    created_at: int = Field(default_factory=lambda: time.time() * 1000)
    updated_at: int = Field(default_factory=lambda: time.time() * 1000)
    sort_value: int = 1
    created_by: str = "basedata-sync-server"
    updated_by: str = "basedata-sync-server"
    obsoleted = False

    class Config:
        use_enum_values = True

    def update_value(self):
        result = self.dict()
        result.pop('created_at')
        result.pop("created_by")
        return result
